package Dispatcher;

/**
 * Asks elevator for its status every 500 ms
 * @author Varun Maryada, Sanat Dixit, Steve Tannahill
 *
 */
public class UpdateThread extends Thread {
	private GroupDispatcher gd;

	public UpdateThread(GroupDispatcher gd) {
		this.gd = gd;
	}

	@Override
	public void run() {
		while (true) {
			try {
				Thread.sleep(500);
				for (int i = 0; i < gd.elevators.size(); i++) {
					gd.elevators.get(i).println("Update\n");
				}
			} catch (InterruptedException e) {}
		}
	}
}